﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LightWeb.Domain;
using LightWeb.Infrastructure;

namespace LightWeb.Application
{
    public class FundsTransferService
    {
        public void Transfer(Account fromAccount, Account toAccount, int amount)
        {
            var bTransaction = BeginTransaction();

            UnitOfWork unitOfWork = new UnitOfWork();

            unitOfWork.Add(toAccount.Credit, amount);

            unitOfWork.Add(fromAccount.Debit, amount);

            unitOfWork.ExecuteWork();

            bTransaction.Commint();
        }



        private BusinessTransaction BeginTransaction()
        {
            return new BusinessTransaction();
        }
    }

    public class BusinessTransaction
    {
        public void Commint()
        { }
    }
}
